namespace pal.SvnConf.Core
{
    //Understands representation of a User in SVN configuration file
    public class User : ISecurityPrincipal
    {
        private string _name;
        private string _password;

        public User(string name, string password)
        {
            _name = name.Trim();
            _password = password.Trim();
        }

        public string Name
        {
            get { return _name; }
        }

        public string ConfigurationUsageName
        {
            get { return _name; }
        }

        public string Password
        {
            get { return _password; }
        }

        public static User Parse(string line)
        {
            return new User(line.Split('=')[0], line.Split('=')[1]);
        }

        public override string ToString()
        {
            return ConfigurationUsageName;
        }
    }
}